From 2096715583cc05db0961178454a7e22c8c987a78 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Wed, 6 Mar 2002 00:30:52 +0000 Subject: [PATCH] When setting the focus to NULL, clear the existing focus chain so that Tue Mar 5 19:19:19 2002 Owen Taylor * gtk/gtkwindow.c (gtk_window_set_focus): When setting the focus to NULL, clear the existing focus chain so that when we focus into the window again, we start at the beginning. (Pointed out by Tim Janik.) --- ChangeLog | 7 +++++++ ChangeLog.pre-2-0 | 7 +++++++ ChangeLog.pre-2-10 | 7 +++++++ ChangeLog.pre-2-2 | 7 +++++++ ChangeLog.pre-2-4 | 7 +++++++ ChangeLog.pre-2-6 | 7 +++++++ ChangeLog.pre-2-8 | 7 +++++++ gtk/gtkwindow.c | 17 ++++++++++++++++- 8 files changed, 65 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index a0391167df..1cac638a67 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Tue Mar 5 19:19:19 2002 Owen Taylor + + * gtk/gtkwindow.c (gtk_window_set_focus): When setting + the focus to NULL, clear the existing focus chain so + that when we focus into the window again, we start + at the beginning. (Pointed out by Tim Janik.) + 2002-03-06 James Henstridge * configure.in: libpango is now called libpango-1.0 diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index a0391167df..1cac638a67 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,10 @@ +Tue Mar 5 19:19:19 2002 Owen Taylor + + * gtk/gtkwindow.c (gtk_window_set_focus): When setting + the focus to NULL, clear the existing focus chain so + that when we focus into the window again, we start + at the beginning. (Pointed out by Tim Janik.) + 2002-03-06 James Henstridge * configure.in: libpango is now called libpango-1.0 diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index a0391167df..1cac638a67 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,10 @@ +Tue Mar 5 19:19:19 2002 Owen Taylor + + * gtk/gtkwindow.c (gtk_window_set_focus): When setting + the focus to NULL, clear the existing focus chain so + that when we focus into the window again, we start + at the beginning. (Pointed out by Tim Janik.) + 2002-03-06 James Henstridge * configure.in: libpango is now called libpango-1.0 diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index a0391167df..1cac638a67 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,10 @@ +Tue Mar 5 19:19:19 2002 Owen Taylor + + * gtk/gtkwindow.c (gtk_window_set_focus): When setting + the focus to NULL, clear the existing focus chain so + that when we focus into the window again, we start + at the beginning. (Pointed out by Tim Janik.) + 2002-03-06 James Henstridge * configure.in: libpango is now called libpango-1.0 diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index a0391167df..1cac638a67 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,10 @@ +Tue Mar 5 19:19:19 2002 Owen Taylor + + * gtk/gtkwindow.c (gtk_window_set_focus): When setting + the focus to NULL, clear the existing focus chain so + that when we focus into the window again, we start + at the beginning. (Pointed out by Tim Janik.) + 2002-03-06 James Henstridge * configure.in: libpango is now called libpango-1.0 diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index a0391167df..1cac638a67 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,10 @@ +Tue Mar 5 19:19:19 2002 Owen Taylor + + * gtk/gtkwindow.c (gtk_window_set_focus): When setting + the focus to NULL, clear the existing focus chain so + that when we focus into the window again, we start + at the beginning. (Pointed out by Tim Janik.) + 2002-03-06 James Henstridge * configure.in: libpango is now called libpango-1.0 diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index a0391167df..1cac638a67 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,10 @@ +Tue Mar 5 19:19:19 2002 Owen Taylor + + * gtk/gtkwindow.c (gtk_window_set_focus): When setting + the focus to NULL, clear the existing focus chain so + that when we focus into the window again, we start + at the beginning. (Pointed out by Tim Janik.) + 2002-03-06 James Henstridge * configure.in: libpango is now called libpango-1.0 diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index fa8f0264d5..20a29d870e 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -961,7 +961,22 @@ gtk_window_set_focus (GtkWindow *window, if (focus) gtk_widget_grab_focus (focus); else - _gtk_window_internal_set_focus (window, NULL); + { + /* Clear the existing focus chain, so that when we focus into + * the window again, we start at the beginnning. + */ + GtkWidget *widget = window->focus_widget; + if (widget) + { + while (widget->parent) + { + widget = widget->parent; + gtk_container_set_focus_child (GTK_CONTAINER (widget), NULL); + } + } + + _gtk_window_internal_set_focus (window, NULL); + } } void -- 2.30.2